package com.test;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/****
 * 重定向  请求路径会变
 *  请求路径需要得到根路径
 *  得不到设置的值
 */
@WebServlet(value="/redirectServlet")
public class RedirectServlet extends HttpServlet{

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setAttribute("name", "lisi2222222");
		resp.sendRedirect(req.getServletContext().getContextPath()+"/dataServlet");
	}
}
